package android.material.util;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.material.widget.ActionView;

import hd.util.ScreenHelper;

/**
 * Action Icon
 * <p/>
 * Created by Haidy on 15/1/5.
 */
public class ActionIcon {

    public static void drawType(Context context, int type, Canvas canvas, int width, int height) {
        canvas.save();
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(Color.WHITE);
        paint.setStyle(Paint.Style.FILL);
        if (type == ActionView.MORE) {
            //绘制圆的半径
            int circleRadius = ScreenHelper.dp2px(context, 2);
            //初始化另外两个圆的位置,中点上面10dp和中点下面10dp
            int absPaintLocation = ScreenHelper.dp2px(context, 10);
            canvas.translate(width / 2, height / 2);
            //先绘制中间的圆
            canvas.drawCircle(0, 0, circleRadius, paint);
            //绘制上面的圆
            canvas.drawCircle(-absPaintLocation, 0, circleRadius, paint);
            //绘制下面的圆
            canvas.drawCircle(absPaintLocation, 0, circleRadius, paint);
        }

        canvas.restore();
    }
}
